<#include "inc/view.html"/>
<@view>
<form id="systemForm${nowtime}" name="systemSetForm" class="form-horizontal" action="/admin/saveSystemSet" method="post"
      data-validator-option="{theme:'yellow_top'}">
    <div class="row">
        <div class="col-sm-6">
            <ol class="breadcrumb">
                <li>
                    <b>系统</b>
                </li>
                <li class="active">系统设置</li>
            </ol>
        </div>
        <div class="col-sm-6">
            <button type="submit" class="btn-sm btn-success pull-right"><i class="ti-save"></i>保存</button>
        </div>
    </div>
    <hr>
    <div class="row">
        <div class="col-sm-12">
            <ul class="nav nav-tabs tabs">
                <li class="active tab">
                    <a href="#sysProfile${nowtime}" data-toggle="tab">
                        <span class="visible-xs"><i class="fa fa-user"></i></span>
                        <span class="hidden-xs">基本设置</span>
                    </a>
                </li>
                <li class="tab">
                    <a href="#emailSet${nowtime}" data-toggle="tab">
                        <span class="visible-xs"><i class="fa fa-envelope-o"></i></span>
                        <span class="hidden-xs">邮箱设置</span>
                    </a>
                </li>
            </ul>
            <div class="tab-content">
                <div class="tab-pane active" id="sysProfile${nowtime}">
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-md-2 control-label">登录验证码</label>
                                <div class="col-md-10">
                                    <label>
                                        <input type="radio" name="system_admin_captcha"<#if 'true'==data.system_admin_captcha!'false'> checked</#if> value="true">启用
                                    </label>
                                    <label>
                                        <input type="radio" name="system_admin_captcha" <#if 'false'==data.system_admin_captcha!'false'> checked</#if> value="false">关闭
                                    </label>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-md-2 control-label">网站LOGO</label>
                                <div class="col-md-10">
                                    <input type="text" class="form-control" name="web_logo" id="weblogo${nowtime}" value="${data.web_logo!'/s/images/logo.png'}">
                                        <div id="filePicker${nowtime}" class=" pull-left">选择图片</div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-md-2 control-label">网站地址</label>
                                <div class="col-md-10">
                                    <input type="text" class="form-control" name="web_front_domain" value="${data.web_front_domain!}">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-md-2 control-label">网站关键字</label>
                                <div class="col-md-10">
                                    <input type="text" class="form-control" name="web_front_keywords" value="${data.web_front_keywords!}">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-md-2 control-label">网站描述</label>
                                <div class="col-md-10">
                                    <input type="text" class="form-control" name="web_front_description" maxlength="50" value="${data.web_front_description!}">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-md-2 control-label">网站底部信息</label>
                                <div class="col-md-10">
                                    <input type="text" class="form-control" name="website_footer" value="${data.website_footer!}">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-md-2 control-label">网站备案号</label>
                                <div class="col-md-10">
                                    <input type="text" class="form-control" name="web_front_beian" value="${data.web_front_beian!}">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-md-2 control-label">网站统计代码</label>
                                <div class="col-md-10">
                                    <input type="text" class="form-control" name="website_tj" value="${data.website_tj?html}">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="tab-pane" id="emailSet${nowtime}">
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-md-2 control-label">POP地址</label>
                                <div class="col-md-10">
                                    <input type="text" class="form-control" name="email_pop" value="${data.email_pop!}">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-md-2 control-label">POP端口</label>
                                <div class="col-md-10">
                                    <input type="text" class="form-control" name="email_pop_port" value="${data.email_pop_port!}">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-md-2 control-label">SMTP地址</label>
                                <div class="col-md-10">
                                    <input type="text" class="form-control" name="email_smtp" value="${data.email_smtp!}">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-md-2 control-label">SMTP端口</label>
                                <div class="col-md-10">
                                    <input type="text" class="form-control" name="email_smtp_port" value="${data.email_smtp_port!}">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-md-2 control-label">邮箱账号</label>
                                <div class="col-md-10">
                                    <input type="text" class="form-control" name="email_acount" value="${data.email_acount!}">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-md-2 control-label">密码</label>
                                <div class="col-md-10">
                                    <input type="text" class="form-control" name="email_acount_password" value="${data.email_acount_password!}">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
</@view>
<script>
    $(function () {
        ajaxForm($("#systemForm${nowtime}"), function (json) {
            if (json.code == RESULT_SUCCESS) {
                contentLoadPage('/system');
            } else {
                if (json.msg)
                    layer.alert(json.msg, {icon: 5, title: '系统提示', shadeClose: true});
            }
        });
        // Web Uploader实例
        var uploader;

        // 初始化Web Uploader
        uploader = WebUploader.create({
            // 自动上传。
            auto: true,
            // swf文件路径
            swf: '/s/plugins/webuploader/Uploader.swf',
            // 文件接收服务端。
            server: '/admin/file/upload4UE?action=uploadimage',
            // 选择文件的按钮。可选。
            // 内部根据当前运行是创建，可能是input元素，也可能是flash.
            pick: '#filePicker${nowtime}',
            // 只允许选择文件，可选。
            accept: {
                title: 'Images',
                extensions: 'gif,jpg,jpeg,bmp,png',
                mimeTypes: 'image/*'
            }
        });
        // 当有文件添加进来的时候
        uploader.on( 'fileQueued', function( file ) {
            uploader.upload();
        });
        // 文件上传成功，给item添加成功class, 用样式标记上传成功。
        uploader.on( 'uploadSuccess', function( file,response) {
            $( '#'+file.id ).addClass('upload-state-done');
            $("#weblogo${nowtime}").val(response.url);
        });
        // 文件上传失败，现实上传出错。
        uploader.on( 'uploadError', function( file ) {
            var $li = $( '#'+file.id ),
                    $error = $li.find('div.error');
            // 避免重复创建
            if ( !$error.length ) {
                $error = $('<div class="error"></div>').appendTo( $li );
            }
            $error.text('上传失败');
        });
        // 完成上传完了，成功或者失败，先删除进度条。
        uploader.on( 'uploadComplete', function( file ) {
            $( '#'+file.id ).find('.progress').remove();
        });
    });
</script>